package com.baijing.springbootstarterdata.web;

import com.baijing.springbootstarterdata.dao.PersonRedisDao;
import com.baijing.springbootstarterdata.domain.PersonRedis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DataRedisController {
    @Autowired
    private PersonRedisDao personRedisDao;

    @RequestMapping("/set")
    public void set() {
        PersonRedis personRedis = new PersonRedis("1", "alice", 18);
        personRedisDao.save(personRedis);
        personRedisDao.stringRedisTemplateDemo();
    }

    @RequestMapping("getStr")
    public String getStr() {
        return personRedisDao.getString();
    }

    @RequestMapping("getPerson")
    public PersonRedis getPerson() {
        return personRedisDao.getPerson();
    }
}
